package com.starblink.android.common.web.dialog

import android.content.Context
import androidx.lifecycle.LifecycleOwner
import com.skydoves.balloon.ArrowOrientation
import com.skydoves.balloon.ArrowPositionRules
import com.skydoves.balloon.Balloon
import com.skydoves.balloon.BalloonHighlightAnimation
import com.skydoves.balloon.createBalloon
import com.skydoves.balloon.overlay.BalloonOverlayRect
import com.skydoves.balloon.overlay.BalloonOverlayRoundRect
import com.starblink.basic.ext.screenWidth
import com.starblink.android.common.R

//web 功能弹框
class FunWebBalloonFactory : Balloon.Factory() {

    override fun create(context: Context, lifecycle: LifecycleOwner?): Balloon {

        return createBalloon(context) {
            setLayout(R.layout.layout_ballon_funweb)
            setArrowOrientation(ArrowOrientation.TOP)
            setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR)
            setArrowPosition(0.5f)
            setArrowWidth(0)
            setArrowHeight(0)
            setOverlayColorResource(R.color.gray_80_900)
            setOverlayShape(BalloonOverlayRoundRect(
                com.starblink.basic.style.R.dimen.d_5dp,
                com.starblink.basic.style.R.dimen.d_5dp
            ))
            setCornerRadius(16f)
            setBackgroundColorResource(com.starblink.basic.style.R.color.white)
            setIsVisibleOverlay(true)
            setDismissWhenShowAgain(true)
            setLifecycleOwner(lifecycle)
            build()
        }
    }
}